package ing.gzq.websocket;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;

import java.io.IOException;

public class WebSocketUtil {

    static Log logger = LogFactory.getLog(WebSocketUtil.class);

    public static void sendMessage(WebSocketSession session,String message) throws IOException {
        if(session == null){
            logger.info("session is null "+ message);
            return;
        }
        session.sendMessage(new TextMessage(message));
    }

}
